import 'package:mziot/app/data/product_group_entity.dart';
import 'package:mziot/generated/json/base/json_convert_content.dart';

ProductGroupEntity $ProductGroupEntityFromJson(Map<String, dynamic> json) {
  final ProductGroupEntity productGroupEntity = ProductGroupEntity();
  final String? productGroupName = jsonConvert.convert<String>(json['productGroupName']);
  if (productGroupName != null) {
    productGroupEntity.productGroupName = productGroupName;
  }
  final String? productGroupImg = jsonConvert.convert<String>(json['productGroupImg']);
  if (productGroupImg != null) {
    productGroupEntity.productGroupImg = productGroupImg;
  }
  final double? productGroupId = jsonConvert.convert<double>(json['productGroupId']);
  if (productGroupId != null) {
    productGroupEntity.productGroupId = productGroupId;
  }
  final List<ProductGroupProductVos>? productVos =
      jsonConvert.convertListNotNull<ProductGroupProductVos>(json['productVos']);
  if (productVos != null) {
    productGroupEntity.productVos = productVos;
  }
  return productGroupEntity;
}

Map<String, dynamic> $ProductGroupEntityToJson(ProductGroupEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['productGroupName'] = entity.productGroupName;
  data['productGroupImg'] = entity.productGroupImg;
  data['productGroupId'] = entity.productGroupId;
  data['productVos'] = entity.productVos?.map((v) => v.toJson()).toList();
  return data;
}

ProductGroupProductVos $ProductGroupProductVosFromJson(Map<String, dynamic> json) {
  final ProductGroupProductVos productGroupProductVos = ProductGroupProductVos();
  final double? productId = jsonConvert.convert<double>(json['productId']);
  if (productId != null) {
    productGroupProductVos.productId = productId;
  }
  final double? productGroupId = jsonConvert.convert<double>(json['productGroupId']);
  if (productGroupId != null) {
    productGroupProductVos.productGroupId = productGroupId;
  }
  final String? productName = jsonConvert.convert<String>(json['productName']);
  if (productName != null) {
    productGroupProductVos.productName = productName;
  }
  final String? productCode = jsonConvert.convert<String>(json['productCode']);
  if (productCode != null) {
    productGroupProductVos.productCode = productCode;
  }
  final String? productImg = jsonConvert.convert<String>(json['productImg']);
  if (productImg != null) {
    productGroupProductVos.productImg = productImg;
  }
  return productGroupProductVos;
}

Map<String, dynamic> $ProductGroupProductVosToJson(ProductGroupProductVos entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['productId'] = entity.productId;
  data['productGroupId'] = entity.productGroupId;
  data['productName'] = entity.productName;
  data['productImg'] = entity.productImg;
  data['productCode'] = entity.productCode;
  return data;
}
